home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1999 November
/
Macworld (1999-11).dmg
/
Updaters
/
WhiteCap 3.0.4
/
WhiteCap Source.sit
/
WhiteCap Source
/
Common
/
General Tools
/
FileSpecList.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1999-07-13
|
1KB
|
69 lines
#include "FileSpecList.h"
#include "CEgFileSpec.h"
FileSpecList::FileSpecList( XStrListOptsT inOption, ListOrderingT inOrdering ) :
mSpecs( cOrderImportant ),
mSpecNames( inOption, inOrdering ) {
}
FileSpecList::~FileSpecList() {
RemoveAll();
}
void FileSpecList::RemoveAll() {
CEgFileSpec* spec;
while ( mSpecs.FetchLast( &spec ) ) {
delete spec;
mSpecs.RemoveLast();
}
mSpecNames.RemoveAll();
}
long FileSpecList::AddCopy( const CEgFileSpec& inSpec ) {
UtilStr name;
long idx;
inSpec.GetFileName( name );
idx = mSpecNames.Add( name );
if ( idx > 0 )
mSpecs.Add( new CEgFileSpec( inSpec ), idx - 1 );
return idx;
}
const CEgFileSpec* FileSpecList::FetchSpec( int inIndex ) const {
return (CEgFileSpec*) mSpecs.Fetch( inIndex );
}
bool FileSpecList::FetchSpecName( int inIndex, UtilStr& outStr ) const {
return mSpecNames.Fetch( inIndex, outStr );
}
const UtilStr* FileSpecList::FetchSpecName( int inIndex ) const {
return mSpecNames.Fetch( inIndex );
}
long FileSpecList::Lookup( UtilStr& inName ) const {
return mSpecNames.FindIndexOf( inName );
}